
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/geometry/polygons.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:26:17 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Polygons &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="polygons.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Plane" href="plane.html" />
    <link rel="prev" title="Ellipses" href="ellipses.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="plane.html" title="Plane"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="ellipses.html" title="Ellipses"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Geometry</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Polygons</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-sympy.geometry.polygon">
<span id="polygons"></span><h1>Polygons<a class="headerlink" href="#module-sympy.geometry.polygon" title="Permalink to this headline">¶</a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.geometry.polygon.</span></span><span class="sig-name descname"><span class="pre">Polygon</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L23-L1405"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon" title="Permalink to this definition">¶</a></dt>
<dd><p>A two-dimensional polygon.</p>
<p>A simple polygon in space. Can be constructed from a sequence of points
or from a center, radius, number of sides and rotation angle.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>vertices</strong> : sequence of Points</p>
<p><strong>Optional parameters</strong></p>
<p><strong>==========</strong></p>
<p><strong>n</strong> : If &gt; 0, an n-sided RegularPolygon is created. See below.</p>
<blockquote>
<div><p>Default value is 0.</p>
</div></blockquote>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>GeometryError</strong></p>
<blockquote>
<div><p>If all parameters are not Points.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Polygons are treated as closed paths rather than 2D areas so
some calculations can be be negative or positive (e.g., area)
based on the orientation of the points.</p>
<p>Any consecutive identical points are reduced to a single point
and any points collinear and between two points will be removed
unless they are needed to define an explicit intersection (see examples).</p>
<p>A Triangle, Segment or Point will be returned when there are 3 or
fewer points provided.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">,</span> <span class="n">p5</span> <span class="o">=</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="go">Polygon(Point2D(0, 0), Point2D(1, 0), Point2D(5, 1), Point2D(0, 1))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">)</span>
<span class="go">Segment2D(Point2D(0, 0), Point2D(1, 0))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p5</span><span class="p">)</span>
<span class="go">Segment2D(Point2D(0, 0), Point2D(3, 0))</span>
</pre></div>
</div>
<p>The area of a polygon is calculated as positive when vertices are
traversed in a ccw direction. When the sides of a polygon cross the
area will have positive and negative contributions. The following
defines a Z shape where the bottom right connects back to the top
left.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span><span class="o">.</span><span class="n">area</span>
<span class="go">0</span>
</pre></div>
</div>
<p>When the the keyword <span class="math notranslate nohighlight">\(n\)</span> is used to define the number of sides of the
Polygon then a RegularPolygon is created and the other arguments are
interpreted as center, radius and rotation. The unrotated RegularPolygon
will always have a vertex at Point(r, 0) where <span class="math notranslate nohighlight">\(r\)</span> is the radius of the
circle that circumscribes the RegularPolygon. Its method <span class="math notranslate nohighlight">\(spin\)</span> can be
used to increment that angle.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">n</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span>
<span class="go">RegularPolygon(Point2D(0, 0), 1, 3, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">vertices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Point2D(1, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Point2D(0, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">spin</span><span class="p">(</span><span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">vertices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Point2D(0, 1)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.Segment" title="sympy.geometry.line.Segment"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle" title="sympy.geometry.polygon.Triangle"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Triangle</span></code></a></p>
</div>
<p class="rubric">Attributes</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 47%" />
<col style="width: 53%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>area</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>angles</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>perimeter</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>vertices</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>centroid</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>sides</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.angles">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">angles</span></span><a class="headerlink" href="#sympy.geometry.polygon.Polygon.angles" title="Permalink to this definition">¶</a></dt>
<dd><p>The internal angle at each vertex.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>angles</strong> : dict</p>
<blockquote>
<div><p>A dictionary where each key is a vertex and each value is the
internal angle at that vertex. The vertices are represented as
Points.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">angles</span><span class="p">[</span><span class="n">p1</span><span class="p">]</span>
<span class="go">pi/2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">angles</span><span class="p">[</span><span class="n">p2</span><span class="p">]</span>
<span class="go">acos(-4*sqrt(17)/17)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.LinearEntity.angle_between" title="sympy.geometry.line.LinearEntity.angle_between"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.LinearEntity.angle_between</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.arbitrary_point">
<span class="sig-name descname"><span class="pre">arbitrary_point</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parameter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'t'</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L778-L835"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.arbitrary_point" title="Permalink to this definition">¶</a></dt>
<dd><p>A parameterized point on the polygon.</p>
<p>The parameter, varying from 0 to 1, assigns points to the position on
the perimeter that is that fraction of the total perimeter. So the
point evaluated at t=1/2 would return the point from the first vertex
that is 1/2 way around the polygon.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>parameter</strong> : str, optional</p>
<blockquote>
<div><p>Default value is ‘t’.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>arbitrary_point</strong> : Point</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong></p>
<blockquote>
<div><p>When <span class="math notranslate nohighlight">\(parameter\)</span> already appears in the Polygon’s definition.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;t&#39;</span><span class="p">,</span> <span class="n">real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">tri</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">tri</span><span class="o">.</span><span class="n">arbitrary_point</span><span class="p">(</span><span class="s1">&#39;t&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">perimeter</span> <span class="o">=</span> <span class="n">tri</span><span class="o">.</span><span class="n">perimeter</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s1</span><span class="p">,</span> <span class="n">s2</span> <span class="o">=</span> <span class="p">[</span><span class="n">s</span><span class="o">.</span><span class="n">length</span> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">tri</span><span class="o">.</span><span class="n">sides</span><span class="p">[:</span><span class="mi">2</span><span class="p">]]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">subs</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="p">(</span><span class="n">s1</span> <span class="o">+</span> <span class="n">s2</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span><span class="o">/</span><span class="n">perimeter</span><span class="p">)</span>
<span class="go">Point2D(1, 1/2)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.area">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">area</span></span><a class="headerlink" href="#sympy.geometry.polygon.Polygon.area" title="Permalink to this definition">¶</a></dt>
<dd><p>The area of the polygon.</p>
<p class="rubric">Notes</p>
<p>The area calculation can be positive or negative based on the
orientation of the points. If any side of the polygon crosses
any other side, there will be areas having opposite signs.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">area</span>
<span class="go">3</span>
</pre></div>
</div>
<p>In the Z shaped polygon (with the lower right connecting back
to the upper left) the areas cancel out:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Z</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Z</span><span class="o">.</span><span class="n">area</span>
<span class="go">0</span>
</pre></div>
</div>
<p>In the M shaped polygon, areas do not cancel because no side
crosses any other (though there is a point of contact).</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">M</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">M</span><span class="o">.</span><span class="n">area</span>
<span class="go">-3/2</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Ellipse.area" title="sympy.geometry.ellipse.Ellipse.area"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Ellipse.area</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.bisectors">
<span class="sig-name descname"><span class="pre">bisectors</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prec</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L1373-L1405"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.bisectors" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns angle bisectors of a polygon. If prec is given
then approximate the point defining the ray to that precision.</p>
<p>The distance between the points defining the bisector ray is 1.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">bisectors</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
<span class="go">{Point2D(0, 0): Ray2D(Point2D(0, 0), Point2D(0.71, 0.71)),</span>
<span class="go"> Point2D(0, 3): Ray2D(Point2D(0, 3), Point2D(0.23, 2.0)),</span>
<span class="go"> Point2D(1, 1): Ray2D(Point2D(1, 1), Point2D(0.19, 0.42)),</span>
<span class="go"> Point2D(2, 0): Ray2D(Point2D(2, 0), Point2D(1.1, 0.38))}</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.bounds">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">bounds</span></span><a class="headerlink" href="#sympy.geometry.polygon.Polygon.bounds" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a tuple (xmin, ymin, xmax, ymax) representing the bounding
rectangle for the geometric figure.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.centroid">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">centroid</span></span><a class="headerlink" href="#sympy.geometry.polygon.Polygon.centroid" title="Permalink to this definition">¶</a></dt>
<dd><p>The centroid of the polygon.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>centroid</strong> : Point</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">centroid</span>
<span class="go">Point2D(31/18, 11/18)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="utils.html#sympy.geometry.util.centroid" title="sympy.geometry.util.centroid"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.util.centroid</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.cut_section">
<span class="sig-name descname"><span class="pre">cut_section</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">line</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L944-L1047"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.cut_section" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a tuple of two polygon segments that lie above and below
the intersecting line respectively.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>line: Line object of geometry module</strong></p>
<blockquote>
<div><p>line which cuts the Polygon. The part of the Polygon that lies
above and below this line is returned.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>upper_polygon, lower_polygon: Polygon objects or None</p>
<blockquote>
<div><p>upper_polygon is the polygon that lies above the given line.
lower_polygon is the polygon that lies below the given line.
upper_polygon and lower polygon are <code class="docutils literal notranslate"><span class="pre">None</span></code> when no polygon
exists above the line or below the line.</p>
</div></blockquote>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError: When the line does not intersect the polygon</strong></p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">Line</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">10</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="n">b</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">rectangle</span><span class="o">.</span><span class="n">cut_section</span><span class="p">(</span><span class="n">Line</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span> <span class="n">slope</span><span class="o">=</span><span class="mi">0</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span>
<span class="go">(Polygon(Point2D(0, 10), Point2D(0, 5), Point2D(20, 5), Point2D(20, 10)),</span>
<span class="go">Polygon(Point2D(0, 5), Point2D(0, 0), Point2D(20, 0), Point2D(20, 5)))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">upper_segment</span><span class="p">,</span> <span class="n">lower_segment</span> <span class="o">=</span> <span class="n">t</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">upper_segment</span><span class="o">.</span><span class="n">area</span>
<span class="go">100</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">upper_segment</span><span class="o">.</span><span class="n">centroid</span>
<span class="go">Point2D(10, 15/2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">lower_segment</span><span class="o">.</span><span class="n">centroid</span>
<span class="go">Point2D(10, 5/2)</span>
</pre></div>
</div>
<p class="rubric">References</p>
<p><a class="reference external" href="https://github.com/sympy/sympy/wiki/A-method-to-return-a-cut-section-of-any-polygon-geometry">https://github.com/sympy/sympy/wiki/A-method-to-return-a-cut-section-of-any-polygon-geometry</a></p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.distance">
<span class="sig-name descname"><span class="pre">distance</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">o</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L1050-L1077"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.distance" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the shortest distance between self and o.</p>
<p>If o is a point, then self does not need to be convex.
If o is another polygon self and o must be convex.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">RegularPolygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="o">*</span><span class="n">RegularPolygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">vertices</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">distance</span><span class="p">(</span><span class="n">p2</span><span class="p">)</span>
<span class="go">sqrt(61)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.encloses_point">
<span class="sig-name descname"><span class="pre">encloses_point</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L691-L776"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.encloses_point" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if p is enclosed by (is inside of) self.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>p</strong> : Point</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>encloses_point</strong> : True, False or None</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Being on the border of self is considered False.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">encloses_point</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">encloses_point</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">encloses_point</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Ellipse.encloses_point" title="sympy.geometry.ellipse.Ellipse.encloses_point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Ellipse.encloses_point</span></code></a></p>
</div>
<p class="rubric">References</p>
<p>[1] <a class="reference external" href="http://paulbourke.net/geometry/polygonmesh/#insidepoly">http://paulbourke.net/geometry/polygonmesh/#insidepoly</a></p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.first_moment_of_area">
<span class="sig-name descname"><span class="pre">first_moment_of_area</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">point</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L442-L508"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.first_moment_of_area" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the first moment of area of a two-dimensional polygon with
respect to a certain point of interest.</p>
<p>First moment of area is a measure of the distribution of the area
of a polygon in relation to an axis. The first moment of area of
the entire polygon about its own centroid is always zero. Therefore,
here it is calculated for an area, above or below a certain point
of interest, that makes up a smaller portion of the polygon. This
area is bounded by the point of interest and the extreme end
(top or bottom) of the polygon. The first moment for this area is
is then determined about the centroidal axis of the initial polygon.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>point: Point, two-tuple of sympifyable objects, or None (default=None)</strong></p>
<blockquote>
<div><p>point is the point above or below which the area of interest lies
If <code class="docutils literal notranslate"><span class="pre">point=None</span></code> then the centroid acts as the point of interest.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Q_x, Q_y: number or sympy expressions</p>
<blockquote>
<div><p>Q_x is the first moment of area about the x-axis
Q_y is the first moment of area about the y-axis
A negative sign indicates that the section modulus is
determined for a section below (or left of) the centroidal axis</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">10</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="n">b</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">first_moment_of_area</span><span class="p">()</span>
<span class="go">(625, 3125)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">first_moment_of_area</span><span class="p">(</span><span class="n">point</span><span class="o">=</span><span class="n">Point</span><span class="p">(</span><span class="mi">30</span><span class="p">,</span> <span class="mi">7</span><span class="p">))</span>
<span class="go">(525, 3000)</span>
</pre></div>
</div>
<p class="rubric">References</p>
<p><a class="reference external" href="https://skyciv.com/docs/tutorials/section-tutorials/calculating-the-statical-or-first-moment-of-area-of-beam-sections/?cc=BMD">https://skyciv.com/docs/tutorials/section-tutorials/calculating-the-statical-or-first-moment-of-area-of-beam-sections/?cc=BMD</a>
<a class="reference external" href="https://mechanicalc.com/reference/cross-sections">https://mechanicalc.com/reference/cross-sections</a></p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.intersection">
<span class="sig-name descname"><span class="pre">intersection</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">o</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L887-L941"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.intersection" title="Permalink to this definition">¶</a></dt>
<dd><p>The intersection of polygon and geometry entity.</p>
<p>The intersection may be empty and can contain individual Points and
complete Line Segments.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>other: GeometryEntity</strong></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>intersection</strong> : list</p>
<blockquote>
<div><p>The list of Segments and Points</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">Line</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly1</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p5</span><span class="p">,</span> <span class="n">p6</span><span class="p">,</span> <span class="n">p7</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly2</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p5</span><span class="p">,</span> <span class="n">p6</span><span class="p">,</span> <span class="n">p7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly1</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="n">poly2</span><span class="p">)</span>
<span class="go">[Point2D(1/3, 1), Point2D(2/3, 0), Point2D(9/5, 1/5), Point2D(7/3, 1)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly1</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">))</span>
<span class="go">[Segment2D(Point2D(0, 0), Point2D(1, 0))]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly1</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="n">p1</span><span class="p">)</span>
<span class="go">[Point2D(0, 0)]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.Segment" title="sympy.geometry.line.Segment"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.is_convex">
<span class="sig-name descname"><span class="pre">is_convex</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L645-L689"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.is_convex" title="Permalink to this definition">¶</a></dt>
<dd><p>Is the polygon convex?</p>
<p>A polygon is convex if all its interior angles are less than 180
degrees and there are no intersections between sides.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>is_convex</strong> : boolean</p>
<blockquote>
<div><p>True if this polygon is convex, False otherwise.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">is_convex</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="utils.html#sympy.geometry.util.convex_hull" title="sympy.geometry.util.convex_hull"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.util.convex_hull</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.perimeter">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">perimeter</span></span><a class="headerlink" href="#sympy.geometry.polygon.Polygon.perimeter" title="Permalink to this definition">¶</a></dt>
<dd><p>The perimeter of the polygon.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>perimeter</strong> : number or Basic instance</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">perimeter</span>
<span class="go">sqrt(17) + 7</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="lines.html#sympy.geometry.line.Segment.length" title="sympy.geometry.line.Segment.length"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment.length</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.plot_interval">
<span class="sig-name descname"><span class="pre">plot_interval</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">parameter</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'t'</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L860-L885"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.plot_interval" title="Permalink to this definition">¶</a></dt>
<dd><p>The plot interval for the default geometric plot of the polygon.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>parameter</strong> : str, optional</p>
<blockquote>
<div><p>Default value is ‘t’.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>plot_interval</strong> : list (plot interval)</p>
<blockquote>
<div><p>[parameter, lower_bound, upper_bound]</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">plot_interval</span><span class="p">()</span>
<span class="go">[t, 0, 1]</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.polar_second_moment_of_area">
<span class="sig-name descname"><span class="pre">polar_second_moment_of_area</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L511-L538"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.polar_second_moment_of_area" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the polar modulus of a two-dimensional polygon</p>
<p>It is a constituent of the second moment of area, linked through
the perpendicular axis theorem. While the planar second moment of
area describes an object’s resistance to deflection (bending) when
subjected to a force applied to a plane parallel to the central
axis, the polar second moment of area describes an object’s
resistance to deflection when subjected to a moment applied in a
plane perpendicular to the object’s central axis (i.e. parallel to
the cross-section)</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a, b&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">b</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span><span class="o">.</span><span class="n">polar_second_moment_of_area</span><span class="p">()</span>
<span class="go">a**3*b/12 + a*b**3/12</span>
</pre></div>
</div>
<p class="rubric">References</p>
<p><a class="reference external" href="https://en.wikipedia.org/wiki/Polar_moment_of_inertia">https://en.wikipedia.org/wiki/Polar_moment_of_inertia</a></p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.second_moment_of_area">
<span class="sig-name descname"><span class="pre">second_moment_of_area</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">point</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L379-L439"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.second_moment_of_area" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the second moment and product moment of area of a two dimensional polygon.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>point</strong> : Point, two-tuple of sympifyable objects, or None(default=None)</p>
<blockquote>
<div><p>point is the point about which second moment of area is to be found.
If “point=None” it will be calculated about the axis passing through the
centroid of the polygon.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>I_xx, I_yy, I_xy</strong> : number or sympy expression</p>
<blockquote>
<div><p>I_xx, I_yy are second moment of area of a two dimensional polygon.
I_xy is product moment of area of a two dimensional polygon.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">symbols</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a, b&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">,</span> <span class="n">p5</span> <span class="o">=</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">b</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="o">/</span><span class="mi">3</span><span class="p">,</span> <span class="n">b</span><span class="o">/</span><span class="mi">3</span><span class="p">)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span><span class="o">.</span><span class="n">second_moment_of_area</span><span class="p">()</span>
<span class="go">(a*b**3/12, a**3*b/12, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span><span class="o">.</span><span class="n">second_moment_of_area</span><span class="p">(</span><span class="n">p5</span><span class="p">)</span>
<span class="go">(a*b**3/9, a**3*b/9, a**2*b**2/36)</span>
</pre></div>
</div>
<p class="rubric">References</p>
<p><a class="reference external" href="https://en.wikipedia.org/wiki/Second_moment_of_area">https://en.wikipedia.org/wiki/Second_moment_of_area</a></p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.section_modulus">
<span class="sig-name descname"><span class="pre">section_modulus</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">point</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L541-L597"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Polygon.section_modulus" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a tuple with the section modulus of a two-dimensional
polygon.</p>
<p>Section modulus is a geometric property of a polygon defined as the
ratio of second moment of area to the distance of the extreme end of
the polygon from the centroidal axis.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>point</strong> : Point, two-tuple of sympifyable objects, or None(default=None)</p>
<blockquote>
<div><p>point is the point at which section modulus is to be found.
If “point=None” it will be calculated for the point farthest from the
centroidal axis of the polygon.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>S_x, S_y: numbers or SymPy expressions</p>
<blockquote>
<div><p>S_x is the section modulus with respect to the x-axis
S_y is the section modulus with respect to the y-axis
A negative sign indicates that the section modulus is
determined for a point below the centroidal axis</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">symbols</span><span class="p">,</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">symbols</span><span class="p">(</span><span class="s1">&#39;a, b&#39;</span><span class="p">,</span> <span class="n">positive</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">b</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span><span class="o">.</span><span class="n">section_modulus</span><span class="p">()</span>
<span class="go">(a*b**2/6, a**2*b/6)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rectangle</span><span class="o">.</span><span class="n">section_modulus</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="n">a</span><span class="o">/</span><span class="mi">4</span><span class="p">,</span> <span class="n">b</span><span class="o">/</span><span class="mi">4</span><span class="p">))</span>
<span class="go">(-a*b**2/3, -a**2*b/3)</span>
</pre></div>
</div>
<p class="rubric">References</p>
<p><a class="reference external" href="https://en.wikipedia.org/wiki/Section_modulus">https://en.wikipedia.org/wiki/Section_modulus</a></p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.sides">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">sides</span></span><a class="headerlink" href="#sympy.geometry.polygon.Polygon.sides" title="Permalink to this definition">¶</a></dt>
<dd><p>The directed line segments that form the sides of the polygon.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>sides</strong> : list of sides</p>
<blockquote>
<div><p>Each side is a directed Segment.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">sides</span>
<span class="go">[Segment2D(Point2D(0, 0), Point2D(1, 0)),</span>
<span class="go">Segment2D(Point2D(1, 0), Point2D(5, 1)),</span>
<span class="go">Segment2D(Point2D(5, 1), Point2D(0, 1)), Segment2D(Point2D(0, 1), Point2D(0, 0))]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.Segment" title="sympy.geometry.line.Segment"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Polygon.vertices">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">vertices</span></span><a class="headerlink" href="#sympy.geometry.polygon.Polygon.vertices" title="Permalink to this definition">¶</a></dt>
<dd><p>The vertices of the polygon.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>vertices</strong> : list of Points</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>When iterating over the vertices, it is more efficient to index self
rather than to request the vertices and index them. Only use the
vertices when you want to process all of them at once. This is even
more important with RegularPolygons that calculate each vertex.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Polygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="n">Point</span><span class="p">,</span> <span class="p">[(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">,</span> <span class="n">p4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">vertices</span>
<span class="go">[Point2D(0, 0), Point2D(1, 0), Point2D(5, 1), Point2D(0, 1)]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">poly</span><span class="o">.</span><span class="n">vertices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Point2D(0, 0)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a></p>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.geometry.polygon.</span></span><span class="sig-name descname"><span class="pre">RegularPolygon</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">c</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">r</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rot</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L1408-L2032"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon" title="Permalink to this definition">¶</a></dt>
<dd><p>A regular polygon.</p>
<p>Such a polygon has all internal angles equal and all sides the same length.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>center</strong> : Point</p>
<p><strong>radius</strong> : number or Basic instance</p>
<blockquote>
<div><p>The distance from the center to a vertex</p>
</div></blockquote>
<p><strong>n</strong> : int</p>
<blockquote>
<div><p>The number of sides</p>
</div></blockquote>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>GeometryError</strong></p>
<blockquote>
<div><p>If the <span class="math notranslate nohighlight">\(center\)</span> is not a Point, or the <span class="math notranslate nohighlight">\(radius\)</span> is not a number or Basic
instance, or the number of sides, <span class="math notranslate nohighlight">\(n\)</span>, is less than three.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>A RegularPolygon can be instantiated with Polygon with the kwarg n.</p>
<p>Regular polygons are instantiated with a center, radius, number of sides
and a rotation angle. Whereas the arguments of a Polygon are vertices, the
vertices of the RegularPolygon must be obtained with the vertices method.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span>
<span class="go">RegularPolygon(Point2D(0, 0), 5, 3, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="o">.</span><span class="n">vertices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Point2D(5, 0)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Polygon" title="sympy.geometry.polygon.Polygon"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Polygon</span></code></a></p>
</div>
<p class="rubric">Attributes</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 58%" />
<col style="width: 42%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>vertices</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>center</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>radius</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>rotation</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>apothem</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>interior_angle</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>exterior_angle</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>circumcircle</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>incircle</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>angles</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.angles">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">angles</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.angles" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a dictionary with keys, the vertices of the Polygon,
and values, the interior angle at each vertex.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="o">.</span><span class="n">angles</span>
<span class="go">{Point2D(-5/2, -5*sqrt(3)/2): pi/3,</span>
<span class="go"> Point2D(-5/2, 5*sqrt(3)/2): pi/3,</span>
<span class="go"> Point2D(5, 0): pi/3}</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.apothem">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">apothem</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.apothem" title="Permalink to this definition">¶</a></dt>
<dd><p>The inradius of the RegularPolygon.</p>
<p>The apothem/inradius is the radius of the inscribed circle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>apothem</strong> : number or instance of Basic</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">radius</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;r&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">radius</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">apothem</span>
<span class="go">sqrt(2)*r/2</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="lines.html#sympy.geometry.line.Segment.length" title="sympy.geometry.line.Segment.length"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment.length</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle.radius" title="sympy.geometry.ellipse.Circle.radius"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Circle.radius</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.area">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">area</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.area" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the area.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">square</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">square</span><span class="o">.</span><span class="n">area</span>
<span class="go">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">_</span> <span class="o">==</span> <span class="n">square</span><span class="o">.</span><span class="n">length</span><span class="o">**</span><span class="mi">2</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.args">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">args</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.args" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the center point, the radius,
the number of sides, and the orientation angle.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="o">.</span><span class="n">args</span>
<span class="go">(Point2D(0, 0), 5, 3, 0)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.center">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">center</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.center" title="Permalink to this definition">¶</a></dt>
<dd><p>The center of the RegularPolygon</p>
<p>This is also the center of the circumscribing circle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>center</strong> : Point</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">center</span>
<span class="go">Point2D(0, 0)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Ellipse.center" title="sympy.geometry.ellipse.Ellipse.center"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Ellipse.center</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.centroid">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">centroid</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.centroid" title="Permalink to this definition">¶</a></dt>
<dd><p>The center of the RegularPolygon</p>
<p>This is also the center of the circumscribing circle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>center</strong> : Point</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">center</span>
<span class="go">Point2D(0, 0)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Ellipse.center" title="sympy.geometry.ellipse.Ellipse.center"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Ellipse.center</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.circumcenter">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">circumcenter</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.circumcenter" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for center.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">circumcenter</span>
<span class="go">Point2D(0, 0)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.circumcircle">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">circumcircle</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.circumcircle" title="Permalink to this definition">¶</a></dt>
<dd><p>The circumcircle of the RegularPolygon.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>circumcircle</strong> : Circle</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">circumcircle</span>
<span class="go">Circle(Point2D(0, 0), 4)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.RegularPolygon.circumcenter" title="sympy.geometry.polygon.RegularPolygon.circumcenter"><code class="xref py py-obj docutils literal notranslate"><span class="pre">circumcenter</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle" title="sympy.geometry.ellipse.Circle"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Circle</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.circumradius">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">circumradius</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.circumradius" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for radius.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">radius</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;r&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">radius</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">circumradius</span>
<span class="go">r</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.encloses_point">
<span class="sig-name descname"><span class="pre">encloses_point</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L1835-L1891"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.encloses_point" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if p is enclosed by (is inside of) self.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>p</strong> : Point</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>encloses_point</strong> : True, False or None</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Being on the border of self is considered False.</p>
<p>The general Polygon.encloses_point method is called only if
a point is not within or beyond the incircle or circumcircle,
respectively.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">S</span><span class="p">,</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">encloses_point</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="p">,</span> <span class="n">R</span> <span class="o">=</span> <span class="n">p</span><span class="o">.</span><span class="n">inradius</span><span class="p">,</span> <span class="n">p</span><span class="o">.</span><span class="n">circumradius</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">encloses_point</span><span class="p">(</span><span class="n">Point</span><span class="p">((</span><span class="n">r</span> <span class="o">+</span> <span class="n">R</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">encloses_point</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="n">R</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="n">R</span><span class="o">/</span><span class="mi">2</span> <span class="o">+</span> <span class="p">(</span><span class="n">R</span> <span class="o">-</span> <span class="n">r</span><span class="p">)</span><span class="o">/</span><span class="mi">10</span><span class="p">))</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;t&#39;</span><span class="p">,</span> <span class="n">real</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">encloses_point</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">arbitrary_point</span><span class="p">()</span><span class="o">.</span><span class="n">subs</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">S</span><span class="o">.</span><span class="n">Half</span><span class="p">))</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span><span class="o">.</span><span class="n">encloses_point</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Ellipse.encloses_point" title="sympy.geometry.ellipse.Ellipse.encloses_point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Ellipse.encloses_point</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.exterior_angle">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">exterior_angle</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.exterior_angle" title="Permalink to this definition">¶</a></dt>
<dd><p>Measure of the exterior angles.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>exterior_angle</strong> : number</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">exterior_angle</span>
<span class="go">pi/4</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="lines.html#sympy.geometry.line.LinearEntity.angle_between" title="sympy.geometry.line.LinearEntity.angle_between"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.LinearEntity.angle_between</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.incircle">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">incircle</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.incircle" title="Permalink to this definition">¶</a></dt>
<dd><p>The incircle of the RegularPolygon.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>incircle</strong> : Circle</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">7</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">incircle</span>
<span class="go">Circle(Point2D(0, 0), 4*cos(pi/7))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.RegularPolygon.inradius" title="sympy.geometry.polygon.RegularPolygon.inradius"><code class="xref py py-obj docutils literal notranslate"><span class="pre">inradius</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle" title="sympy.geometry.ellipse.Circle"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Circle</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.inradius">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">inradius</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.inradius" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for apothem.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">radius</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;r&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">radius</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">inradius</span>
<span class="go">sqrt(2)*r/2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.interior_angle">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">interior_angle</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.interior_angle" title="Permalink to this definition">¶</a></dt>
<dd><p>Measure of the interior angles.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>interior_angle</strong> : number</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">interior_angle</span>
<span class="go">3*pi/4</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="lines.html#sympy.geometry.line.LinearEntity.angle_between" title="sympy.geometry.line.LinearEntity.angle_between"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.LinearEntity.angle_between</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.length">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">length</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.length" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the length of the sides.</p>
<p>The half-length of the side and the apothem form two legs
of a right triangle whose hypotenuse is the radius of the
regular polygon.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sqrt</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="n">square_in_unit_circle</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span><span class="o">.</span><span class="n">length</span>
<span class="go">sqrt(2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">sqrt</span><span class="p">((</span><span class="n">_</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">s</span><span class="o">.</span><span class="n">apothem</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span> <span class="o">==</span> <span class="n">s</span><span class="o">.</span><span class="n">radius</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.radius">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">radius</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.radius" title="Permalink to this definition">¶</a></dt>
<dd><p>Radius of the RegularPolygon</p>
<p>This is also the radius of the circumscribing circle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>radius</strong> : number or instance of Basic</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">radius</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;r&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">radius</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">radius</span>
<span class="go">r</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="lines.html#sympy.geometry.line.Segment.length" title="sympy.geometry.line.Segment.length"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment.length</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle.radius" title="sympy.geometry.ellipse.Circle.radius"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Circle.radius</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.reflect">
<span class="sig-name descname"><span class="pre">reflect</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">line</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L1964-L1990"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.reflect" title="Permalink to this definition">¶</a></dt>
<dd><p>Override GeometryEntity.reflect since this is not made of only
points.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Line</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">RegularPolygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span><span class="o">.</span><span class="n">reflect</span><span class="p">(</span><span class="n">Line</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">slope</span><span class="o">=-</span><span class="mi">2</span><span class="p">))</span>
<span class="go">RegularPolygon(Point2D(4/5, 2/5), -1, 4, atan(4/3))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.rotate">
<span class="sig-name descname"><span class="pre">rotate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">angle</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L1915-L1936"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.rotate" title="Permalink to this definition">¶</a></dt>
<dd><p>Override GeometryEntity.rotate to first rotate the RegularPolygon
about its center.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">vertices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="c1"># vertex on x-axis</span>
<span class="go">Point2D(2, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">rotate</span><span class="p">(</span><span class="n">pi</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">vertices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="c1"># vertex on y axis now</span>
<span class="go">Point2D(0, 2)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.RegularPolygon.rotation" title="sympy.geometry.polygon.RegularPolygon.rotation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rotation</span></code></a></p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.geometry.polygon.RegularPolygon.spin" title="sympy.geometry.polygon.RegularPolygon.spin"><code class="xref py py-obj docutils literal notranslate"><span class="pre">spin</span></code></a></dt><dd><p>Rotates a RegularPolygon in place</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.rotation">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">rotation</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.rotation" title="Permalink to this definition">¶</a></dt>
<dd><p>CCW angle by which the RegularPolygon is rotated</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>rotation</strong> : number or instance of Basic</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">a</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="n">pi</span><span class="o">/</span><span class="mi">4</span><span class="p">)</span><span class="o">.</span><span class="n">rotation</span>
<span class="go">pi/4</span>
</pre></div>
</div>
<p>Numerical rotation angles are made canonical:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span><span class="o">.</span><span class="n">rotation</span>
<span class="go">a</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="n">pi</span><span class="p">)</span><span class="o">.</span><span class="n">rotation</span>
<span class="go">0</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.scale">
<span class="sig-name descname"><span class="pre">scale</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L1938-L1962"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.scale" title="Permalink to this definition">¶</a></dt>
<dd><p>Override GeometryEntity.scale since it is the radius that must be
scaled (if x == y) or else a new Polygon must be returned.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">RegularPolygon</span>
</pre></div>
</div>
<p>Symmetric scaling returns a RegularPolygon:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">RegularPolygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span><span class="o">.</span><span class="n">scale</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">RegularPolygon(Point2D(0, 0), 2, 4, 0)</span>
</pre></div>
</div>
<p>Asymmetric scaling returns a kite as a Polygon:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">RegularPolygon</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span><span class="o">.</span><span class="n">scale</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">Polygon(Point2D(2, 0), Point2D(0, 1), Point2D(-2, 0), Point2D(0, -1))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.spin">
<span class="sig-name descname"><span class="pre">spin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">angle</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L1893-L1913"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.spin" title="Permalink to this definition">¶</a></dt>
<dd><p>Increment <em>in place</em> the virtual Polygon’s rotation by ccw angle.</p>
<p>See also: rotate method which moves the center.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Polygon</span><span class="p">,</span> <span class="n">Point</span><span class="p">,</span> <span class="n">pi</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="n">n</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="o">.</span><span class="n">vertices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Point2D(1, 0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="o">.</span><span class="n">spin</span><span class="p">(</span><span class="n">pi</span><span class="o">/</span><span class="mi">6</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="o">.</span><span class="n">vertices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="go">Point2D(sqrt(3)/2, 1/2)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.RegularPolygon.rotation" title="sympy.geometry.polygon.RegularPolygon.rotation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rotation</span></code></a></p>
<dl class="simple">
<dt><a class="reference internal" href="#sympy.geometry.polygon.RegularPolygon.rotate" title="sympy.geometry.polygon.RegularPolygon.rotate"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rotate</span></code></a></dt><dd><p>Creates a copy of the RegularPolygon rotated about a Point</p>
</dd>
</dl>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.RegularPolygon.vertices">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">vertices</span></span><a class="headerlink" href="#sympy.geometry.polygon.RegularPolygon.vertices" title="Permalink to this definition">¶</a></dt>
<dd><p>The vertices of the RegularPolygon.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>vertices</strong> : list</p>
<blockquote>
<div><p>Each vertex is a Point.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">RegularPolygon</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span> <span class="o">=</span> <span class="n">RegularPolygon</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rp</span><span class="o">.</span><span class="n">vertices</span>
<span class="go">[Point2D(5, 0), Point2D(0, 5), Point2D(-5, 0), Point2D(0, -5)]</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a></p>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">sympy.geometry.polygon.</span></span><span class="sig-name descname"><span class="pre">Triangle</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L2035-L2835"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Triangle" title="Permalink to this definition">¶</a></dt>
<dd><p>A polygon with three vertices and three sides.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>points</strong> : sequence of Points</p>
<p><strong>keyword: asa, sas, or sss to specify sides/angles of the triangle</strong></p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>GeometryError</strong></p>
<blockquote>
<div><p>If the number of vertices is not equal to three, or one of the vertices
is not a Point, or a valid keyword is not given.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="go">Triangle(Point2D(0, 0), Point2D(4, 0), Point2D(4, 3))</span>
</pre></div>
</div>
<p>Keywords sss, sas, or asa can be used to give the desired
side lengths (in order) and interior angles (in degrees) that
define the triangle:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Triangle</span><span class="p">(</span><span class="n">sss</span><span class="o">=</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<span class="go">Triangle(Point2D(0, 0), Point2D(3, 0), Point2D(3, 4))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Triangle</span><span class="p">(</span><span class="n">asa</span><span class="o">=</span><span class="p">(</span><span class="mi">30</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">30</span><span class="p">))</span>
<span class="go">Triangle(Point2D(0, 0), Point2D(1, 0), Point2D(1/2, sqrt(3)/6))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Triangle</span><span class="p">(</span><span class="n">sas</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">45</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="go">Triangle(Point2D(0, 0), Point2D(2, 0), Point2D(sqrt(2)/2, sqrt(2)/2))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Polygon" title="sympy.geometry.polygon.Polygon"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Polygon</span></code></a></p>
</div>
<p class="rubric">Attributes</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 63%" />
<col style="width: 37%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>vertices</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>altitudes</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>orthocenter</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>circumcenter</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>circumradius</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>circumcircle</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>inradius</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>incircle</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>exradii</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>medians</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>medial</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>nine_point_circle</p></td>
<td></td>
</tr>
</tbody>
</table>
<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.altitudes">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">altitudes</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.altitudes" title="Permalink to this definition">¶</a></dt>
<dd><p>The altitudes of the triangle.</p>
<p>An altitude of a triangle is a segment through a vertex,
perpendicular to the opposite side, with length being the
height of the vertex measured from the line containing the side.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>altitudes</strong> : dict</p>
<blockquote>
<div><p>The dictionary consists of keys which are vertices and values
which are Segments.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">altitudes</span><span class="p">[</span><span class="n">p1</span><span class="p">]</span>
<span class="go">Segment2D(Point2D(0, 0), Point2D(1/2, 1/2))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.Segment.length" title="sympy.geometry.line.Segment.length"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment.length</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.bisectors">
<span class="sig-name descname"><span class="pre">bisectors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L2471-L2509"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Triangle.bisectors" title="Permalink to this definition">¶</a></dt>
<dd><p>The angle bisectors of the triangle.</p>
<p>An angle bisector of a triangle is a straight line through a vertex
which cuts the corresponding angle in half.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>bisectors</strong> : dict</p>
<blockquote>
<div><p>Each key is a vertex (Point) and each value is the corresponding
bisector (Segment).</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">Segment</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sqrt</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">bisectors</span><span class="p">()[</span><span class="n">p2</span><span class="p">]</span> <span class="o">==</span> <span class="n">Segment</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">sqrt</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.Segment" title="sympy.geometry.line.Segment"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.circumcenter">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">circumcenter</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.circumcenter" title="Permalink to this definition">¶</a></dt>
<dd><p>The circumcenter of the triangle</p>
<p>The circumcenter is the center of the circumcircle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>circumcenter</strong> : Point</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">circumcenter</span>
<span class="go">Point2D(1/2, 1/2)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.circumcircle">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">circumcircle</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.circumcircle" title="Permalink to this definition">¶</a></dt>
<dd><p>The circle which passes through the three vertices of the triangle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>circumcircle</strong> : Circle</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">circumcircle</span>
<span class="go">Circle(Point2D(1/2, 1/2), sqrt(2)/2)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle" title="sympy.geometry.ellipse.Circle"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Circle</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.circumradius">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">circumradius</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.circumradius" title="Permalink to this definition">¶</a></dt>
<dd><p>The radius of the circumcircle of the triangle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>circumradius</strong> : number of Basic instance</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">Symbol</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">Symbol</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">circumradius</span>
<span class="go">sqrt(a**2/4 + 1/4)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle.radius" title="sympy.geometry.ellipse.Circle.radius"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Circle.radius</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.eulerline">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">eulerline</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.eulerline" title="Permalink to this definition">¶</a></dt>
<dd><p>The Euler line of the triangle.</p>
<p>The line which passes through circumcenter, centroid and orthocenter.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>eulerline</strong> : Line (or Point for equilateral triangles in which case all</p>
<blockquote>
<div><p>centers coincide)</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">eulerline</span>
<span class="go">Line2D(Point2D(0, 0), Point2D(1/2, 1/2))</span>
</pre></div>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.excenters">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">excenters</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.excenters" title="Permalink to this definition">¶</a></dt>
<dd><p>Excenters of the triangle.</p>
<p>An excenter is the center of a circle that is tangent to a side of the
triangle and the extensions of the other two sides.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>excenters</strong> : dict</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>The excenters are keyed to the side of the triangle to which their corresponding
excircle is tangent: The center is keyed, e.g. the excenter of a circle touching
side 0 is:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">excenters</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">sides</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>
<span class="go">Point2D(12*sqrt(10), 2/3 + sqrt(10)/3)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.Triangle.exradii" title="sympy.geometry.polygon.Triangle.exradii"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.polygon.Triangle.exradii</span></code></a></p>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r486"><span class="brackets"><a class="fn-backref" href="#id1">R486</a></span></dt>
<dd><p><a class="reference external" href="http://mathworld.wolfram.com/Excircles.html">http://mathworld.wolfram.com/Excircles.html</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.exradii">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">exradii</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.exradii" title="Permalink to this definition">¶</a></dt>
<dd><p>The radius of excircles of a triangle.</p>
<p>An excircle of the triangle is a circle lying outside the triangle,
tangent to one of its sides and tangent to the extensions of the
other two.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>exradii</strong> : dict</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<p>The exradius touches the side of the triangle to which it is keyed, e.g.
the exradius touching side 2 is:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">exradii</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">sides</span><span class="p">[</span><span class="mi">2</span><span class="p">]]</span>
<span class="go">-2 + sqrt(10)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.Triangle.inradius" title="sympy.geometry.polygon.Triangle.inradius"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.polygon.Triangle.inradius</span></code></a></p>
</div>
<p class="rubric">References</p>
<p>[1] <a class="reference external" href="http://mathworld.wolfram.com/Exradius.html">http://mathworld.wolfram.com/Exradius.html</a>
[2] <a class="reference external" href="http://mathworld.wolfram.com/Excircles.html">http://mathworld.wolfram.com/Excircles.html</a></p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.incenter">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">incenter</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.incenter" title="Permalink to this definition">¶</a></dt>
<dd><p>The center of the incircle.</p>
<p>The incircle is the circle which lies inside the triangle and touches
all three sides.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>incenter</strong> : Point</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">incenter</span>
<span class="go">Point2D(1 - sqrt(2)/2, 1 - sqrt(2)/2)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.Triangle.incircle" title="sympy.geometry.polygon.Triangle.incircle"><code class="xref py py-obj docutils literal notranslate"><span class="pre">incircle</span></code></a>, <a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.incircle">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">incircle</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.incircle" title="Permalink to this definition">¶</a></dt>
<dd><p>The incircle of the triangle.</p>
<p>The incircle is the circle which lies inside the triangle and touches
all three sides.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>incircle</strong> : Circle</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">incircle</span>
<span class="go">Circle(Point2D(2 - sqrt(2), 2 - sqrt(2)), 2 - sqrt(2))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle" title="sympy.geometry.ellipse.Circle"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Circle</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.inradius">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">inradius</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.inradius" title="Permalink to this definition">¶</a></dt>
<dd><p>The radius of the incircle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>inradius</strong> : number of Basic instance</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">inradius</span>
<span class="go">1</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.Triangle.incircle" title="sympy.geometry.polygon.Triangle.incircle"><code class="xref py py-obj docutils literal notranslate"><span class="pre">incircle</span></code></a>, <a class="reference internal" href="ellipses.html#sympy.geometry.ellipse.Circle.radius" title="sympy.geometry.ellipse.Circle.radius"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.ellipse.Circle.radius</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.is_equilateral">
<span class="sig-name descname"><span class="pre">is_equilateral</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L2215-L2243"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Triangle.is_equilateral" title="Permalink to this definition">¶</a></dt>
<dd><p>Are all the sides the same length?</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>is_equilateral</strong> : boolean</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span><span class="o">.</span><span class="n">is_equilateral</span><span class="p">()</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy</span> <span class="kn">import</span> <span class="n">sqrt</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t2</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="o">*</span><span class="n">sqrt</span><span class="p">(</span><span class="mi">3</span><span class="p">)))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t2</span><span class="o">.</span><span class="n">is_equilateral</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="entities.html#sympy.geometry.entity.GeometryEntity.is_similar" title="sympy.geometry.entity.GeometryEntity.is_similar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.entity.GeometryEntity.is_similar</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.RegularPolygon" title="sympy.geometry.polygon.RegularPolygon"><code class="xref py py-obj docutils literal notranslate"><span class="pre">RegularPolygon</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_isosceles" title="sympy.geometry.polygon.Triangle.is_isosceles"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_isosceles</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_right" title="sympy.geometry.polygon.Triangle.is_right"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_right</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_scalene" title="sympy.geometry.polygon.Triangle.is_scalene"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_scalene</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.is_isosceles">
<span class="sig-name descname"><span class="pre">is_isosceles</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L2245-L2267"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Triangle.is_isosceles" title="Permalink to this definition">¶</a></dt>
<dd><p>Are two or more of the sides the same length?</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>is_isosceles</strong> : boolean</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span><span class="o">.</span><span class="n">is_isosceles</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_equilateral" title="sympy.geometry.polygon.Triangle.is_equilateral"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_equilateral</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_right" title="sympy.geometry.polygon.Triangle.is_right"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_right</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_scalene" title="sympy.geometry.polygon.Triangle.is_scalene"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_scalene</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.is_right">
<span class="sig-name descname"><span class="pre">is_right</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L2293-L2319"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Triangle.is_right" title="Permalink to this definition">¶</a></dt>
<dd><p>Is the triangle right-angled.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>is_right</strong> : boolean</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span><span class="o">.</span><span class="n">is_right</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="lines.html#sympy.geometry.line.LinearEntity.is_perpendicular" title="sympy.geometry.line.LinearEntity.is_perpendicular"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.LinearEntity.is_perpendicular</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_equilateral" title="sympy.geometry.polygon.Triangle.is_equilateral"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_equilateral</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_isosceles" title="sympy.geometry.polygon.Triangle.is_isosceles"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_isosceles</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_scalene" title="sympy.geometry.polygon.Triangle.is_scalene"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_scalene</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.is_scalene">
<span class="sig-name descname"><span class="pre">is_scalene</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L2269-L2291"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Triangle.is_scalene" title="Permalink to this definition">¶</a></dt>
<dd><p>Are all the sides of the triangle of different lengths?</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>is_scalene</strong> : boolean</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span><span class="o">.</span><span class="n">is_scalene</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_equilateral" title="sympy.geometry.polygon.Triangle.is_equilateral"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_equilateral</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_isosceles" title="sympy.geometry.polygon.Triangle.is_isosceles"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_isosceles</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.is_right" title="sympy.geometry.polygon.Triangle.is_right"><code class="xref py py-obj docutils literal notranslate"><span class="pre">is_right</span></code></a></p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.is_similar">
<span class="sig-name descname"><span class="pre">is_similar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t2</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/geometry/polygon.py#L2161-L2213"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.geometry.polygon.Triangle.is_similar" title="Permalink to this definition">¶</a></dt>
<dd><p>Is another triangle similar to this one.</p>
<p>Two triangles are similar if one can be uniformly scaled to the other.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>other: Triangle</strong></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><strong>is_similar</strong> : boolean</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t2</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="o">-</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="o">-</span><span class="mi">4</span><span class="p">,</span> <span class="o">-</span><span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span><span class="o">.</span><span class="n">is_similar</span><span class="p">(</span><span class="n">t2</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">t2</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="o">-</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="o">-</span><span class="mi">4</span><span class="p">,</span> <span class="o">-</span><span class="mi">4</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t1</span><span class="o">.</span><span class="n">is_similar</span><span class="p">(</span><span class="n">t2</span><span class="p">)</span>
<span class="go">False</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="entities.html#sympy.geometry.entity.GeometryEntity.is_similar" title="sympy.geometry.entity.GeometryEntity.is_similar"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.entity.GeometryEntity.is_similar</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.medial">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">medial</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.medial" title="Permalink to this definition">¶</a></dt>
<dd><p>The medial triangle of the triangle.</p>
<p>The triangle which is formed from the midpoints of the three sides.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>medial</strong> : Triangle</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">medial</span>
<span class="go">Triangle(Point2D(1/2, 0), Point2D(1/2, 1/2), Point2D(0, 1/2))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="lines.html#sympy.geometry.line.Segment.midpoint" title="sympy.geometry.line.Segment.midpoint"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment.midpoint</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.medians">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">medians</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.medians" title="Permalink to this definition">¶</a></dt>
<dd><p>The medians of the triangle.</p>
<p>A median of a triangle is a straight line through a vertex and the
midpoint of the opposite side, and divides the triangle into two
equal areas.</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>medians</strong> : dict</p>
<blockquote>
<div><p>Each key is a vertex (Point) and each value is the median (Segment)
at that point.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">medians</span><span class="p">[</span><span class="n">p1</span><span class="p">]</span>
<span class="go">Segment2D(Point2D(0, 0), Point2D(1/2, 1/2))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point.midpoint" title="sympy.geometry.point.Point.midpoint"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point.midpoint</span></code></a>, <a class="reference internal" href="lines.html#sympy.geometry.line.Segment.midpoint" title="sympy.geometry.line.Segment.midpoint"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment.midpoint</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.nine_point_circle">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">nine_point_circle</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.nine_point_circle" title="Permalink to this definition">¶</a></dt>
<dd><p>The nine-point circle of the triangle.</p>
<p>Nine-point circle is the circumcircle of the medial triangle, which
passes through the feet of altitudes and the middle points of segments
connecting the vertices and the orthocenter.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>nine_point_circle</strong> : Circle</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">nine_point_circle</span>
<span class="go">Circle(Point2D(1/4, 1/4), sqrt(2)/4)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="lines.html#sympy.geometry.line.Segment.midpoint" title="sympy.geometry.line.Segment.midpoint"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.line.Segment.midpoint</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.medial" title="sympy.geometry.polygon.Triangle.medial"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.polygon.Triangle.medial</span></code></a>, <a class="reference internal" href="#sympy.geometry.polygon.Triangle.orthocenter" title="sympy.geometry.polygon.Triangle.orthocenter"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.polygon.Triangle.orthocenter</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.orthocenter">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">orthocenter</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.orthocenter" title="Permalink to this definition">¶</a></dt>
<dd><p>The orthocenter of the triangle.</p>
<p>The orthocenter is the intersection of the altitudes of a triangle.
It may lie inside, outside or on the triangle.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>orthocenter</strong> : Point</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Point</span><span class="p">,</span> <span class="n">Triangle</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">orthocenter</span>
<span class="go">Point2D(0, 0)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a></p>
</div>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="sympy.geometry.polygon.Triangle.vertices">
<em class="property"><span class="pre">property</span> </em><span class="sig-name descname"><span class="pre">vertices</span></span><a class="headerlink" href="#sympy.geometry.polygon.Triangle.vertices" title="Permalink to this definition">¶</a></dt>
<dd><p>The triangle’s vertices</p>
<dl class="field-list">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><strong>vertices</strong> : tuple</p>
<blockquote>
<div><p>Each element in the tuple is a Point</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.geometry</span> <span class="kn">import</span> <span class="n">Triangle</span><span class="p">,</span> <span class="n">Point</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">Triangle</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Point</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span><span class="o">.</span><span class="n">vertices</span>
<span class="go">(Point2D(0, 0), Point2D(4, 0), Point2D(4, 3))</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="points.html#sympy.geometry.point.Point" title="sympy.geometry.point.Point"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sympy.geometry.point.Point</span></code></a></p>
</div>
</dd></dl>

</dd></dl>

</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="ellipses.html"
                        title="previous chapter">Ellipses</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="plane.html"
                        title="next chapter">Plane</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/geometry/polygons.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="plane.html" title="Plane"
             >next</a> |</li>
        <li class="right" >
          <a href="ellipses.html" title="Ellipses"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Geometry</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Polygons</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/geometry/polygons.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:26:17 GMT -->
</html>